home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Script / Scriptable Apps Searcher 1.0 / Finder Liaison / Finder Liaison ReadMe < prev    next >
Encoding:
Text File  |  1993-11-10  |  7.8 KB  |  168 lines  |  [TEXT/ttxt]

  1. Finder Liaison
  2. version 1.1  10-Nov-93
  3.  
  4. Description:
  5. Finder Liaison sends AppleEvents to the Finder. Requires System 7 or later.
  6.  
  7. Usage:
  8. The System 7 Finder supports the Finder Suite of AppleEvents. Unfortunately, there is no way to explicitly send AppleEvents to the Finder from AppleScript. Finder Liaison acts as an intermediary between AppleScript and the Finder.
  9.  
  10. Distribution:
  11. Finder Liaison is copyrighted, but free, commonly called Freeware. The author retains all rights to the program, but specifically allows redistribution via the following channels:
  12.  
  13. (1) The disk associated with the book "The Tao of AppleScript" by BMUG
  14. (2) Non-commercial bulletin board services
  15. (3) The following commercial BBS's: America Online, CompuServe, AppleLink
  16. (4) Internet archives and file servers
  17. (5) Disk libraries of non-profit organizations
  18. (6) Free exchange between individuals
  19.  
  20. In all cases, this ReadMe file must accompany the program.
  21.  
  22. For-profit companies that sell software programs must receive explicit written permission from the author before distributing the program.
  23.  
  24. Credits:
  25. Written by: Gregory H. Dow
  26. Icons by: Chris Holmes
  27. Useful ideas by: Derrick Schneider
  28.  
  29. © 1993 Gregory H. Dow. All rights reserved.
  30.  
  31. Send comments to:
  32. Gregory H. Dow
  33. 1678 Shattuck Ave #302
  34. Berkeley, CA  94709-1631
  35.  
  36. America Online: GHD
  37. Internet: ghd@aol.com
  38.  
  39. • Version History
  40. 1.0         11-Jun-93     Ships with "The Tao of AppleScript" book by BMUG
  41. 1.1b1        23-Aug-93    Supports full path names for files and folders
  42. 1.1b2        05-Oct-93        Updates Finder display when changing the Creator/Type/Name
  43.                                                                             of a File/Folder which is in an open window
  44. 1.1b3        07-Oct-93    Supports creating new folders
  45. 1.1        10-Nov-93    New release
  46.  
  47.  
  48. • AppleEvents supported by Finder Liaison:
  49.  
  50. Show About This Mac
  51. Empty Trash
  52. Restart
  53. Show Clipboard
  54. Shut Down
  55. Sleep
  56.  
  57. Close Window of <Folder or Disk>
  58. Print Window of <Folder or Disk>
  59. Page Setup for <Folder or Disk>
  60.         Example: Close Window of Folder "Documents" of Disk "HD80"
  61.  
  62. Open <File or Folder or Disk>
  63. Duplicate <File or Folder or Disk>
  64. Get Info for <File or Folder or Disk>
  65. Make Alias of <File or Folder or Disk>
  66. Print <File or Folder or Disk>
  67. Put Away <File or Folder or Disk>
  68. Reveal <File or Folder or Disk>
  69. Show Sharing for <File or Folder or Disk>
  70.         Examples:  Open File “Letter” of Folder “Correspondence” of Disk “Personal”
  71.                           Put Away Disk “Floppy”
  72.                           Duplicate File “abc” of Folder “Desktop Folder” of Disk “HD20”
  73.                                  Note: This is how to refer to a File/Folder on the Desktop
  74.  
  75. Set View of <Folder or Disk> to <view option>
  76.     <view option> may be: by Small Icon, by Icon, by Name, by Date, by Size, by Kind, by Comment, by Label, by Version
  77.         Example: Set View of Folder "Icons" of Disk "Art" To by Name
  78.  
  79. Move Window of <Folder or Disk> To <location>
  80.     <location> is the {left,top} position
  81.         Example:  Move Window of Folder "Programs" of Disk "HD40" To {200,50}
  82.  
  83. Set Window Size of <Folder or Disk> to <size>
  84.     <size> is {width,height}
  85.         Example:  Set Window Size of Disk “My Drive” To {500, 300}
  86.  
  87. Zoom Out Window of    <Folder or Disk>
  88. Zoom In Window of    <Folder or Disk>
  89.         Example:    Zoom In Window of Folder “xx” of Folder “yy” of Disk “zz”
  90.  
  91. Move    <File or Folder of Disk>    To    <Folder or Disk>    [At    <location>]
  92. Drag Copy of    <File or Folder of Disk>    To    <Folder or Disk>    [At    <location>]
  93.     <location> is an optional parameter specifying the {top,left} position
  94.         Example:    Move File “script” of Disk “HD40” To Folder “xx” of Disk “HD40” At {10, 50}
  95.                        Drag Copy of Folder “tables” of Disk “Drive” To Folder “x” of Disk “Drive”
  96. * The optional <location> parameter is supposed to specify where in the window to move/drag the icons. However, it doesn’t appear to work in a consistent or understandable manner.
  97.  
  98. Set Creator of    <File>    To    <ostype>
  99. Set Type of    <File>    To    <ostype>
  100.     <ostype> is a four-character code (it is an error if <ostype> is not exactly four characters)
  101.         Example:    Set Creator of File “letter” of Disk “HD80” To “MSWD”
  102.  
  103. Get Creator of    <File>
  104. Get Type of    <File>
  105.     returns Creator/Type code of the specified file as a four-character string
  106.         Example: Get Creator of File “spreadsheet” of Folder “docs” of Disk “mine”
  107.  
  108. Set Name of    <File or Folder of Disk>    To    <Name>
  109.         Example: Set Name of File “untitled” of Disk “HD40” To “My Letter”
  110.  
  111. Get Path of    <File or Folder of Disk>
  112.     returns the full pathname for the specified item. Does not matter if item exists or not (since you many want to use this pathname to create a new file).
  113.         Example: Get Path of File “script” of Folder “stuff” of Disk “HD160”
  114.  
  115. Create    <File or Folder>    [replacing     <yes/no>]
  116.     creates an empty File (with both data and resource forks). The optional 'replacing' parameter specifies whether to replace the file if it already exists. The default is no.
  117.         Example: Create File “Empty” of Folder “Docs” of Disk “HD20” replacing yes
  118. The 'replacing' parameter is not supported for folders, and it is an error to use
  119. 'replacing' when creating a folder.
  120.         Example: Create Folder "Papers" of Disk "HD80"
  121.  
  122. Get Files in    <Folder of Disk>
  123.     returns a list of the names of the Files in the specified Folder or Disk. Not full pathnames, just the file names.
  124.         Example: Get Files in Folder “Letters” of Disk “HD50”
  125.  
  126. Get Folders in    <Folder of Disk>
  127.     returns a list of the names of the Folders in the specified Folder or Disk . Not full pathnames, just the folder names.
  128.         Example: Get Folders in Folder “Applications” of Disk “HD60”
  129.  
  130.  
  131. • Specifying Files, Folders, or Disks
  132.     
  133. You can specify a File by a container list, such as:
  134.     File "agenda" of Folder "Documents" of Folder "Personal" of Disk "HardDrive"
  135. Or, you can use a full path name, which for the same example as above is:
  136.     "HardDrive:Personal:Documents:agenda"
  137. A full path name specifies the names in the reverse order, separating folder and disk names with a colon (":").
  138.  
  139. The same holds true for Folders. Here is an example container list:
  140.     Folder "Notes" of "Folder "Meetings" of Disk "Accounting"
  141. And here is the same folder as a full path name:
  142.     "Accounting:Meetings:Notes:"
  143. The colon at the end is *very* important. That's how you distinguish a folder from a file. In a full path name, you can think of a folder or disk name as including the trailing colon.
  144.  
  145. For Disks, there isn't much difference between a container list and a full path. The container list specification doesn't have a colon, the full path name does.
  146.     Container List:   Disk "My Floppy"
  147.     Full Path Name:  Disk "My Floppy:"
  148.  
  149. Normally, you should use the container list form in your scripts, However, the full path name form is needed when accessing files from the list of items returned by the "on open" message. You use this message to create script applications with drag-and-drop capability (called a "droplet"). The string representation of an item from the list returned by "on open" is a full path name. You can distinguish files from folders/disks by checking if the string ends with a colon (file names don't end with a colon; folder and disk names do end with a colon).
  150.  
  151. Here is an example script for a droplet that operates on the items dropped on it by creating aliases of folders and disks and duplicating files:
  152.  
  153. on open (theItems)
  154.     tell application "Finder Liaison 1.1"
  155.         repeat with currItem in theItems
  156.             copy (currItem as string) to pathName
  157.             if pathName ends with ":" then
  158.                 -- item is a folder or disk, create an Alias
  159.                 Make Alias of Folder pathName
  160.             else
  161.                 -- item is a file, Duplicate it
  162.                 Duplicate File pathName
  163.             end if
  164.         end repeat
  165.     end tell
  166. end open
  167.  
  168. Note that it's OK to refer to all path names ending with a colon as Folders, even though they may actually be disks. Finder Liaison treats Folders and Disks the same; they both are containers of (other) folders and files.